﻿using DAL.Database.EasierMVC.DB.EF.Schema;
using Infra.CustomException;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL.Database.EasierMVC.DB.EF
{
    public class DbContextFactory
    { 
        public static DbContext Create(Action<string> log)
        {
            try
            {
                return new DatabaseContext(log);
            }
            catch (Exception e)
            {
                throw new DalException(e);
            }
        }

        public static DbContext Create(string connectionstring, Action<string> log)
        {
            try
            {
                return new DatabaseContext(connectionstring, log);
            }
            catch (Exception e)
            {
                throw new DalException(e);
            }
        }
    }
}
